A hash set is a collection of items, without any particular order and without repetitions stored in a hash table. More...
#include <thashset.h>
Public Types | |
typedef uint32(* | THashFunc )(const T &, uint32) |
Hash function type. | |
Public Member Functions | |
THashSet (int32=10) | |
Default constructor, size = number of buckets. | |
THashSet (THashFunc, int32=10) | |
Constructor with hash function, size = number of buckets. | |
THashSet (const THashSet< T > &) | |
Copy constructor - uses copy, copy used add. | |
THashSet (THashFunc, const TContainer< T > &) | |
Container with hash function and container to copy. | |
~THashSet () | |
Destructor. | |
THashSet< T > & | operator= (const THashTable< T > &) |
Assignment operator, uses copy. | |
THashSet< T > | operator- (const THashSet< T > &) const |
Difference operator. | |
THashSet< T > | operator& (const THashSet< T > &) const |
Intersection operator. | |
THashSet< T > | operator| (const THashSet< T > &) const |
Union operator. | |
bool | add (const T &) |
Add item to set if not already contained. |
A hash set is a collection of items, without any particular order and without repetitions stored in a hash table.
A hash table stores its items in hash buckets whose pointers are stored in an array at the index given by the hash function, which is a integer function of the item. The buckets are necessary to hold all items with the same hash index.
typedef uint32(* THashFunc)(const T &, uint32) |
Hash function type.
Reimplemented from THashTable< T >.
THashSet | ( | int32 | size = 10 |
) | [inline] |
Default constructor, size = number of buckets.
[in] | size | Number of buckets in the new hash set. |
Constructor with hash function, size = number of buckets.
[in] | func | Hash function the hash set uses. |
[in] | size | Number of buckets in the new hash set |
Copy constructor - uses copy, copy used add.
[in] | set | Hash set to copy. |
THashSet | ( | THashFunc | func, | |
const TContainer< T > & | cont | |||
) | [inline] |
Container with hash function and container to copy.
[in] | func | Hash function the set uses. |
[in] | cont | Container to construct the table from. |
~THashSet | ( | ) | [inline] |
Destructor.
THashSet< T > & operator= | ( | const THashTable< T > & | table | ) | [inline] |
Assignment operator, uses copy.
[in] | table | Assign input set or table to this set. |
Difference operator.
[in] | set | Contains items to be subtracted. |
Intersection operator.
[in] | set | Contains items to be intersected. |
Union operator.
[in] | set | Contains items to be united. |
bool add | ( | const T & | item | ) | [inline, virtual] |
Add item to set if not already contained.
[in] | item | Item that will be added if no similar item is already contained by the set. |
Reimplemented from THashTable< T >.